# coding:utf-8

import codecs;
import socket;
import ftplib;
import libvirt;

if(__name__ == "__main__"):
    
#    a = 97;
#    a = chr(a);
#    
#    b = bytearray(a);
#    print len(b),b[0];
#    b = bytearray(2);
#    b[0]=255;
#    b[1]=218;
#    bu = buffer(b);
#        
#    print type(bu),len(bu);
#    st = str(bu);
#    print  st;    
#    print hex(b[0]);
#    
#    print b.decode("utf-8");

#    print "a".encode("hex");

    soc = socket.socket(socket.AF_INET,socket.SOCK_STREAM,0);
    address = ("192.168.10.148",8080);
    soc.connect(address);
    
    f = open("xingkong.jpg", "rb");
    
    
    while(True):
        s = f.read(1024);
        
        if(not s):
            break;
        else:
            b = bytearray(s);
            bu = buffer(b);
            soc.send(bu);
                
    pass
    f.close();
    soc.close();
    raw_input("sss...");
    
